package org.ndx.jsg.input.image;

import java.io.File;

import org.apache.tika.metadata.Metadata;
import org.ndx.jsg.FileInfos;
import org.ndx.jsg.MimeTypes;
import org.ndx.jsg.input.FileInfosBuilder;
import org.ndx.jsg.input.adapter.BuilderAdapter;

public class ImageBuilder extends BuilderAdapter implements FileInfosBuilder {
	@Override
	protected FileInfos create(File f, String relativePath, Metadata metadata) {
		return new ImageFileInfos(f, relativePath, metadata);
	}

	@Override
	protected boolean matches(File f, String relativePath, Metadata metadata) {
		String contentType = metadata.get(Metadata.CONTENT_TYPE);
		return (MimeTypes.IMAGE_GIF.equals(contentType) || MimeTypes.IMAGE_JPEG.equals(contentType) ||MimeTypes.IMAGE_PNG.equals(contentType) );
	}
}
